<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
	<title>GRDN LOG</title>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
	
	<!-- See http://blog.jqueryui.com/2011/02/jquery-ui-1-8-10/ for more jquery ui theme links  -->
	<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet" />
	
	<link href="/css/styles.css" type="text/css" rel="stylesheet" />
	
</head>
<body>
	<div id="center-section">
		<div id="header">
			<img src="/images/grdnlog-logo.png" alt="logo" />
			<span style="float:right;"><a href="/mvc/log">Posts</a> | <a href="${authUrl}">Logout</a></span>
		</div>
		
	    <div id="content">
		    <div>
				<h2>My Configs</h2>
				<table>
				<c:forEach var="configItem" items="${configs}">
					<tr>
						<td>
							<c:out value="${configItem.twitterName}" />
						</td>
						<td>
							<form:form method="POST">
								<input type="hidden" name="id" value="<c:out value="${configItem.id}" />" />
								<input type="submit" name="delete-config" value="Delete" />
							</form:form>
						</td>
					</tr>
				</c:forEach>
				</table>
			</div>
			
			<div>
				<h2>Add a Config</h2>
				<form:form method="POST" modelAttribute="config">
					<div class="field">
						<label for="twitterName">Twitter Screen Name</label>
						<form:input path="twitterName" cssClass="field" cssErrorClass="field-error" />
						<form:errors path="twitterName" />
					</div>
					<div class="field">
						<label for="taggedOnly">Tagged Only</label>
						<form:checkbox path="taggedOnly" />
						<form:errors path="taggedOnly" />
					</div>
					<input type="submit" name="save" value="Save" />
				</form:form>
			</div>
		</div>
	</div>
</body>
</html>